#ifndef LOGMANAGER_H
#define LOGMANAGER_H

#include "Types.h"
#include "LogOutput.h"
#include "Log.h"

namespace logging {

typedef std::map<char*, Log*, ltstr> LogMap;

class LogMapIterator;

class LogManager
{
protected:
	LogManager();

public:
	~LogManager();

	static LogManager* getInstance();
	static Log* getLog(char* ns);

	LogMapIterator getLogs() const;
	
protected:
	Log* createOrReturn(char* ns);

private:
	concurrent::Mutex _lMutex;
	LogMap _logs;

	LogOutput *_output;
	static LogManager *_instance;
};

class LogMapIterator
{
public:
	LogMapIterator(LogMap *map);

	bool hasNext() const;
	Log* next();

private:
	LogMap *_map;
	LogMap::const_iterator _current;
};

}

#endif /* LOGMANAGER_H */
